//
//  Config.m
//  WuyouTang
//
//  Created by cat on 16/3/9.
//  Copyright © 2016年 cat. All rights reserved.
//
#import "Config.h"
NSString * const YBCoin = @"coin";
NSString * const YBAge = @"age";
NSString * const YBArea = @"area";
NSString * const YBAvatar = @"avatar";
NSString * const YBAvatarThumb = @"avatar_thumb";
NSString * const YBBirth = @"birthday";
NSString * const YBCity = @"city";
NSString * const YBCode = @"code";
NSString * const YBHomeTown = @"hometown";
NSString * const YBID = @"ID";
NSString * const YBProvince = @"province";
NSString * const YBSex = @"sex";
NSString * const YBSignature = @"signature";
NSString * const YBToken = @"token";
NSString * const YBUserNiceName = @"user_nickname";
NSString * const YBIsreg = @"isreg";
NSString * const YBFirstBonus = @"isFirstBonus";
NSString * const YBTxUserSign = @"tx_user_sign";

@implementation Config

//登陆统一存储
+(void)saveUnified:(NSDictionary *)dic {
    
    NSString *yb_coin = [NSString stringWithFormat:@"%@",[dic valueForKey:@"coin"]];
    NSString *yb_age = [NSString stringWithFormat:@"%@",[dic valueForKey:@"age"]];
    NSString *yb_area = [NSString stringWithFormat:@"%@",[dic valueForKey:@"area"]];
    NSString *yb_avatar = [NSString stringWithFormat:@"%@",[dic valueForKey:@"avatar"]];
    NSString *yb_avatarthumb = [NSString stringWithFormat:@"%@",[dic valueForKey:@"avatar_thumb"]];
    NSString *yb_birth = [NSString stringWithFormat:@"%@",[dic valueForKey:@"birthday"]];
    NSString *yb_city = [NSString stringWithFormat:@"%@",[dic valueForKey:@"city"]];
    NSString *yb_code = [NSString stringWithFormat:@"%@",[dic valueForKey:@"code"]];
    NSString *yb_hometown = [NSString stringWithFormat:@"%@",[dic valueForKey:@"hometown"]];
    NSString *yb_id = [NSString stringWithFormat:@"%@",[dic valueForKey:@"id"]];
    NSString *yb_province = [NSString stringWithFormat:@"%@",[dic valueForKey:@"province"]];
    NSString *yb_sex = [NSString stringWithFormat:@"%@",[dic valueForKey:@"sex"]];
    NSString *yb_signature = [NSString stringWithFormat:@"%@",[dic valueForKey:@"signature"]];
    NSString *yb_token = [NSString stringWithFormat:@"%@",[dic valueForKey:@"token"]];
    NSString *yb_usernicename = [NSString stringWithFormat:@"%@",[dic valueForKey:@"user_nickname"]];
    NSString *yb_isreg = [NSString stringWithFormat:@"%@",[dic valueForKey:@"isreg"]];
    NSString *tx_login_sign = [NSString stringWithFormat:@"%@",[dic valueForKey:@"usersign"]];

    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:yb_coin forKey:YBCoin];
    [userDefaults setObject:yb_age forKey:YBAge];
    [userDefaults setObject:yb_area forKey:YBArea];
    [userDefaults setObject:yb_avatar forKey:YBAvatar];
    [userDefaults setObject:yb_avatarthumb forKey:YBAvatarThumb];
    [userDefaults setObject:yb_birth forKey:YBBirth];
    [userDefaults setObject:yb_city forKey:YBCity];
    [userDefaults setObject:yb_code forKey:YBCode];
    [userDefaults setObject:yb_hometown forKey:YBHomeTown];
    [userDefaults setObject:yb_id forKey:YBID];
    [userDefaults setObject:yb_province forKey:YBProvince];
    [userDefaults setObject:yb_sex forKey:YBSex];
    [userDefaults setObject:yb_signature forKey:YBSignature];
    [userDefaults setObject:yb_token forKey:YBToken];
    [userDefaults setObject:yb_usernicename forKey:YBUserNiceName];
    [userDefaults setObject:yb_isreg forKey:YBIsreg];
    [userDefaults setObject:tx_login_sign forKey:YBTxUserSign];

    [userDefaults synchronize];
}
//统一清除
+(void)clearUnified {
    
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults removeObjectForKey:YBCoin];
    [userDefaults removeObjectForKey:YBAge];
    [userDefaults removeObjectForKey:YBArea];
    [userDefaults removeObjectForKey:YBAvatar];
    [userDefaults removeObjectForKey:YBAvatarThumb];
    [userDefaults removeObjectForKey:YBBirth];
    [userDefaults removeObjectForKey:YBCity];
    [userDefaults removeObjectForKey:YBCode];
    [userDefaults removeObjectForKey:YBHomeTown];
    [userDefaults removeObjectForKey:YBID];
    [userDefaults removeObjectForKey:YBProvince];
    [userDefaults removeObjectForKey:YBSex];
    [userDefaults removeObjectForKey:YBSignature];
    [userDefaults removeObjectForKey:YBToken];
    [userDefaults removeObjectForKey:YBUserNiceName];
    [userDefaults removeObjectForKey:YBIsreg];
    [userDefaults removeObjectForKey:YBTxUserSign];

    [userDefaults synchronize];
}

#pragma mark - 用户ID
+(void)saveOwnID:(NSString *)save {
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBID];
    [userDefaults synchronize];
}
+(NSString *)getOwnID {
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBID];
    return getStr;
}

#pragma mark - 用户token
+(void)saveOwnToken:(NSString *)save {
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBToken];
    [userDefaults synchronize];
}
+(NSString *)getOwnToken {
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBToken];
    return getStr;
}

#pragma mark - 用户昵称
+(void)saveOwnNicename:(NSString *)save{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBUserNiceName];
    [userDefaults synchronize];
}
+(NSString *)getOwnNicename{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBUserNiceName];
    return getStr;
}

#pragma mark - 用户签名
+(void)saveOwnSignature:(NSString *)save{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBSignature];
    [userDefaults synchronize];
}
+(NSString *)getOwnSignature{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBSignature];
    return getStr;
}

#pragma mark - 年龄
+(void)saveUserAge:(NSString *)save{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBAge];
    [userDefaults synchronize];
}
+(NSString *)getUserAge{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBAge];
    return getStr;
}
#pragma mark - 金币
+(void)saveUserCoin:(NSString *)save {
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBCoin];
    [userDefaults synchronize];
}
+(NSString *)getUserCoin {
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBCoin];
    return getStr;
}
#pragma mark - 头像
+(void)saveUserAvatar:(NSString *)save{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBAvatar];
    [userDefaults synchronize];
}
+(NSString *)getUserAvatar{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBAvatar];
    return getStr;
}
+(void)saveUserAvatarThumb:(NSString *)save{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBAvatarThumb];
    [userDefaults synchronize];
}
+(NSString *)getUserAvatarThumb{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBAvatarThumb];
    return getStr;
}

#pragma mark - 生日
+(void)saveUserBirth:(NSString *)save{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBBirth];
    [userDefaults synchronize];
}
+(NSString *)getUserBirth{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBBirth];
    return getStr;
}

#pragma mark - 性别
+(void)saveUserSex:(NSString *)save{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBSex];
    [userDefaults synchronize];
}
+(NSString *)getUserSex{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBSex];
    return getStr;
}

#pragma mark - 邀请码
+(void)saveUserCode:(NSString *)save{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBCode];
    [userDefaults synchronize];
}
+(NSString *)getUserCode{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBCode];
    return getStr;
}

#pragma mark - 用户地址(注意不是定位地址，而是个人中心编辑的个人地址)
+(void)saveUserProvince:(NSString *)save{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBProvince];
    [userDefaults synchronize];
}
+(NSString *)getUserProvince{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBProvince];
    return getStr;
}
+(void)saveUserCity:(NSString *)save{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBCity];
    [userDefaults synchronize];
}
+(NSString *)getUserCity{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBCity];
    return getStr;
}
+(void)saveUserArea:(NSString *)save{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBArea];
    [userDefaults synchronize];
}
+(NSString *)getUserArea{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBArea];
    return getStr;
}
+(void)saveUserHomeTown:(NSString *)save{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    [userDefaults setObject:save forKey:YBHomeTown];
    [userDefaults synchronize];
}
+(NSString *)getUserHomeTown{
    NSUserDefaults *userDefaults = [[NSUserDefaults alloc]init ];
    NSString *getStr = [userDefaults objectForKey:YBHomeTown];
    return getStr;
}
#pragma mark - 首次登陆
+(void)saveisreg:(NSString *)isregs{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:isregs forKey:YBIsreg];
    [userDefaults synchronize];
}
+(NSString *)getreg{
    NSUserDefaults *userDefults = [NSUserDefaults standardUserDefaults];
    NSString *gameStates = [userDefults objectForKey:YBIsreg];
    return gameStates;
}
#pragma mark - 当从个人中心删除了视频时做个标记当返回推荐时候重新请求数据
+(void)saveSignOfDelVideo:(NSString *)str {
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:str forKey:@"center_del_sign"];
    [userDefaults synchronize];
}
+(NSString *)getSignOfDelVideo {
    NSUserDefaults *userDefults = [NSUserDefaults standardUserDefaults];
    NSString *adress = [userDefults objectForKey:@"center_del_sign"];
    return adress;
}

#pragma makr - 保存提现dic
+(void)saveCashAccount:(NSDictionary *)save;{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:save forKey:@"yb_cash_account"];
    [userDefaults synchronize];
}
+(NSDictionary *)getCashAccount;{
    NSUserDefaults *userDefults = [NSUserDefaults standardUserDefaults];
    NSDictionary *getDic = [userDefults objectForKey:@"yb_cash_account"];
    return getDic;
}
+(void)removeCashAccount{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults removeObjectForKey:@"yb_cash_account"];
    [userDefaults synchronize];
}

#pragma mark -是否第一次签到
+(void)saveFirstBonus:(NSString *)save{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:save forKey:YBFirstBonus];
    [userDefaults synchronize];

}
+(NSString *)getFirstBonus{
    NSUserDefaults *userDefults = [NSUserDefaults standardUserDefaults];
    NSString *gameStates = [userDefults objectForKey:YBFirstBonus];
    return gameStates;

}

+(NSString *)lgetUserSign{
    NSUserDefaults *userDefults = [NSUserDefaults standardUserDefaults];
    NSString *sign = [userDefults objectForKey:YBTxUserSign];
    return sign;

}
#pragma mark - 未读消息基数
+(void)saveImUnreadNum:(int)save; {
    NSUserDefaults *userDefults = [NSUserDefaults standardUserDefaults];
    [userDefults setObject:[NSString stringWithFormat:@"%d",save] forKey:@"yb_im_unreads"];
    [userDefults synchronize];
}
+(int)getImUnreadNum; {
    NSUserDefaults *userDefults = [NSUserDefaults standardUserDefaults];
    int getInt = [strFormat([userDefults objectForKey:@"yb_im_unreads"]) intValue];
    return getInt;
}
+(void)saveTranslate:(BOOL)isTeanslate{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setBool:isTeanslate forKey:@"yb_translate"];
    [userDefaults synchronize];
}
+(BOOL)getTranslate{
    NSUserDefaults *userDefults = [NSUserDefaults standardUserDefaults];
    NSString *translate = [userDefults objectForKey:@"yb_translate"];
    return translate;

}
+(void)saveCurrentIsShop:(BOOL)isShop{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setBool:isShop forKey:@"yb_isShop"];
    [userDefaults synchronize];

}
+(BOOL)getCurrentIsShop;
{
    NSUserDefaults *userDefults = [NSUserDefaults standardUserDefaults];
    BOOL isShop = [userDefults boolForKey:@"yb_isShop"];
    return isShop;

}
@end
